-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Organized, a few details added in competitive #5
base: master
Are you sure you want to change the base?
Conversation
Thanks for working on this. However, I see several issues with your pull request. I think you should have talked to me before beginning work on it. But don't worry, we'll improve your pull request. You also have too many commits. I was expecting around 5 to 10 commits. I'll shortly begin review. After you fix all issues I point out, squash your commits into a few meaningful commits. |
Your pull request also seems incomplete, as can be seen in I have no problem with you trying to do everything in a single pull request, but usually people split their work across various pull requests depending on the type of work and submit them one by one. You could have, for example, submitted work on competitive programming in one pull request, work on organizing tools, adding license, etc. in another pull request. |
I don't think we need a verbatim copy of a license in a |
All file and directory names should be lowercase and hyphen-separated. This is needed because these file and folder names will be part of URLs and it is a best practice to keep URL names lowercase (so that they are easily memorizable). URLs shouldn't have spaces between them, otherwise we'll have to use ugly |
I'm not convinced that we need a TC to GCC porting guide. We should just tell them that TC is not standards-compliant and they should look at code written for GCC to find out what all changes do they need. There aren't many changes except those related to IO and standard libraries, and people should look up docs for them anyways (because they have a lot of important information), whether they used TC previously or not. I too used non-standard C++ (Visual C++ 1998) in school, but switching was easy once I looked at one or two GCC-targeted programs. |
I'm sorry to say that you have done a bad job at writing English. Your sentences have many grammatical and typographical errors. You have not used or incorrectly used punctuation. Your sentences are sometimes too long and need to be split. Please be vigilant and avoid making such mistakes in the future. I'm not just referring to these articles, but anything you write in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have completed my review. Reviewing took a lot of time, since you had a lot of new material and there are lot of issues to be addressed. It's great that you took out the time to write a C to C++ porting guide.
I think you are a bit verbose. I'm not sure whether what you have written can be written in lesser words, but try to do it if possible.
Please take care of your spelling and grammar. Before sending any pull requests, do a critical proofreading to ensure that no mistakes have crept in.
If you disagree with anything I have said, feel free to mention it and we'll discuss what the right solution can be.
I didn't check, but if you have written parts of the article in a personal tone (like using words like 'I', 'me', etc.) please mention yourself as the author in the beginning of the article.
Competitive Programming/CP1.md
Outdated
@@ -30,10 +30,12 @@ If you know only C, you can easily start. | |||
But at some point of time (especially when you reach advanced stages), | |||
you'll need features which most languages have but C does not. | |||
Learning C++ is very easy if you know C. | |||
If you already know C, you should start competitive programming in C and learn C++ in parallel. | |||
If you already know C, you should start competitive programming in C and learn C++ in parallel. You may refer to [C to C++ for Competetive](c2cpp.md) after you solve [a few basic problems](#making-the-first-step) for a brief intro and resources . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be changed to
You may refer to C to C++ for Competitive Programming for a brief intro and resources after you solve a few basic problems using C.
Also, avoid using too long lines in markdown. This sentence should come in the next line and not in the same line as 'If you already know C, ...'.
Competitive Programming/CP1.md
Outdated
Competitive programming is also a good way to practice a new language you have learned. | ||
Competitive programming is also a good way to practice a new language you have learned. | ||
|
||
If you have no prior knowledge you can begin with [CS50 2016](http://cs50.tv/2016/fall/) (week 0 to week 5) (it teaches c which anyways is useful as its part of BITS Curriculum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/its/it's
(It means replace its
by it's
).
s/it teaches c which anyways is useful/it teaches C, which is anyways useful
s/Curriculum/curriculum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split sentence into multiple lines. Preferably less than 80 to 100 characters per line.
Competitive Programming/CP1.md
Outdated
@@ -78,7 +80,9 @@ If you have never before solved a problems on an online judge, you can begin by | |||
the easiest problem on Codechef - [Life, the Universe, and Everything](https://www.codechef.com/problems/TEST). | |||
You will have to read the [Input/Output tutorial](http://blog.codechef.com/2009/02/24/54/) to solve the problem. | |||
If you face problems, you can refer to [Eklavya's solutions](https://www.codechef.com/status/TEST,sharmaeklavya2). | |||
He has submitted code in many languages, so you'll most likely find a solution in the language of your choice. | |||
He has submitted code in many languages, so you'll most likely find a solution in the language of your choice. | |||
Also codechef has [screencasts](https://www.youtube.com/playlist?list=PLi0ZM-RCX5ntfqwXRirwA_pcufHinjllG) explaining this problem in c,c++ and java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Also/Also,
Split sentence into multiple lines.
s/c,c++ and java/C, C++ and Java.
Use title-case for language names.
Always end a sentence with a full stop.
Add a space after a comma.
Competitive Programming/CP1.md
Outdated
He has submitted code in many languages, so you'll most likely find a solution in the language of your choice. | ||
He has submitted code in many languages, so you'll most likely find a solution in the language of your choice. | ||
Also codechef has [screencasts](https://www.youtube.com/playlist?list=PLi0ZM-RCX5ntfqwXRirwA_pcufHinjllG) explaining this problem in c,c++ and java | ||
After this you can move on to more problems from [codechef beginner section](https://www.codechef.com/problems/school?sort_by=SuccessfulSubmission&sorting_order=desc) these problems mostly require only basic knowledge of programming(arrays, strings, loops) and math/logic. The ones with the code like FLOW??? are particularly very easy and can help you get aquainted with submissions on online judges. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this line a new paragraph and split it into multiple lines.
s/) these problems/). These problems
s/programming(arrays/programming (arrays
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is FLOW???
?
Competitive Programming/CP1.md
Outdated
@@ -130,12 +134,12 @@ and he got AIR 7 in a Codechef Long challenge! | |||
|
|||
## Compiler | |||
|
|||
One frequently asked question is what compiler or IDE to use. | |||
One frequently asked question is what [compiler or IDE](#diff) to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does #diff
link to?
Competitive Programming/c2cpp.md
Outdated
|
||
int main() | ||
{ | ||
int t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please indent your code.
Competitive Programming/c2cpp.md
Outdated
return 0; | ||
} | ||
``` | ||
To compile this program on linux use `gcc --std=c++11 filename.cpp -o example` to run use `./example`. For codeblocks use build and run in build menu. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/build and run/'build and run'
Competitive Programming/c2cpp.md
Outdated
} | ||
``` | ||
|
||
the line cin>>a>>b>>c; is es exactly same as cin>>a; cin>>b; cin>>c; this is known as cascading of `>>` operator similarly we have the next line where `<<` operator is cascaded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surround in-line code by backticks.
Competitive Programming/c2cpp.md
Outdated
To compile this program on linux use `gcc --std=c++11 filename.cpp -o example` to run use `./example`. For codeblocks use build and run in build menu. | ||
|
||
# NEW in CPP (useful for competitive) | ||
## easier IO (cin and cout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know about C++ IO being slower? I think it's worth mentioning that, since beginners will have no idea why they're getting TLE otherwise.
intro.md
Outdated
@@ -0,0 +1,7 @@ | |||
This file has an intro for various articles in this repository | |||
|
|||
## Backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to add links.
When you want me to review it again, inform me by posting a comment on this thread. |
I am still working on this. Will update soon. |
rename tools.md to tools1.md
minor changes in CP1.md
undoing certain unintended changes
Thanks for a detailed review, I have tried to incorporate the suggested changes. I also need guidance in improving C to C++ guide. Please tell if you want any material to be added/ removed. I too feel that it is getting a bit comprehensive. |
There has been a force push and it's difficult to track whether these issues were addressed or not.
I think you should remove your second snippet and everything after that and before (but not including) the point about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CP1.md
looks good except for a few issues I have pointed out and that you should split long lines.
c2cpp.md
still has long lines and occasional lexical issues, in addition to issues I have explicitly commented on.
@@ -31,10 +31,14 @@ But at some point of time (especially when you reach advanced stages), | |||
you'll need features which most languages have but C does not. | |||
Learning C++ is very easy if you know C. | |||
If you already know C, you should start competitive programming in C and learn C++ in parallel. | |||
> You may refer to [C to C++ for Competitive Programming](c2cpp.md) for a brief intro and resources after you solve [a few basic problems](#making-the-first-step) using C. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should remove the >
symbol from the beginning of the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split this sentence into 2 lines.
@@ -135,14 +144,14 @@ One frequently asked question is what compiler or IDE to use. | |||
If you have Linux or Mac, it is best to use: | |||
|
|||
* gcc for C | |||
* g++ for C++ | |||
* javac for Java (both oracle and openjdk are good) | |||
* gcc/g++ for C++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it's possible to compile C++ code using gcc
, it's much more convenient to use g++
. I think you should change 'gcc/g++' to 'g++', since this article is aimed at beginners and we don't want to trouble/confuse them by making them try gcc
to compile C++ code.
1) Porting C's code to C++ | ||
2) A couple of things new/different in C++ w.r.t C and are useful for competitive. | ||
|
||
## Prerequisite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change it to 'Prerequisites'.
|
||
We require that you are aware of at least the following concepts in C: | ||
|
||
* Basic Syntax of C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in this list (loops, arrays, functions) is 'Basic Syntax of C', so remove this point and make 'Basic Input and Output' and 'Operators' first-level points.
We will be using the line `#include<bits/stdc++.h>` in our code to resolve all issues at once. | ||
`<bits/stdc++.h>` is basically a header file containing all the standard C++ header files (header files for C/C++ , most STL files etc.). | ||
Though it's not a good development practice to include unnecessary headers. It is pretty common in competitive, | ||
as judges use runtime for the time limit and this only increases my compile time and not my runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove 'my's from this sentence. <bits/stdc++.h>
increases everyone's compile time, not just yours.
int main() | ||
{ | ||
int a,b; | ||
char Str[10]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should set a good example for others by not beginning variable names with an uppercase character. Identifiers which begin with an uppercase character are generally used as class names. Identifiers in which all characters are uppercase are generally macros or constants.
1 2 | ||
Hello World | ||
``` | ||
In the real scenario, I will press 1 'space' 2 'enter' Hello 'space' World 'enter' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to explain this?
c=Hello | ||
``` | ||
Note: | ||
1. Though the input is broken at whitespaces, `cin>>something;` is not executed while you are typing the input. It is only executed after pressing enter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what you mean by this. something
isn't defined in your snippet above so I think you're talking about using cin
in general. If the input buffer doesn't contain everything cin
wants, it will perform a read
system call. The system call will block unless you type something and press enter. So technically, while the user is typing, cin>>something
is being executed.
Note: | ||
1. Though the input is broken at whitespaces, `cin>>something;` is not executed while you are typing the input. It is only executed after pressing enter. | ||
That makes us type in `Hello world` without reaching `return 0;`. | ||
2. Multiple whitespaces between the input are ignored while using cin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to explain points like this, because cin
takes input in exactly the same way as scanf
afaik.
To compile this program on linux, use `gcc --std=c++11 filename.cpp -o example` to run use `./example`. | ||
For Code::Blocks use `build and run` in the build menu. | ||
|
||
## New in C++ (useful for competitive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should change 'New' to 'Extra', since C++ is a fairly old language.
Just for the update: |
I'll probably be busy till midsems, so take your time. |
No description provided.